@echo off

for /f %%i in ("%0") do set curpath=%%~dpi
set curpath=%curpath: =%

set _dist_dir=dist_%date:~4,2%%date:~7,2%%date:~10,4%

if exist %_dist_dir% goto skip_create_dir

md %_dist_dir%

:skip_create_dir

rem copy files on root
for /f "usebackq" %%f in (`dir /b /a-d`) do (
 xcopy %%f %_dist_dir% /y
)


rem copy directories on root and its sub
for /f "usebackq" %%f in (`dir /b`) do (
 if not %_dist_dir% equ %%f do (
  xcopy "%%f" "%_dist_dir%\%%f" /e /y /i
 )
)


rem delete .svn files
for /r %curpath%%_dist_dir% %%f in (.svn) do (
 if exist %%f do (
  echo Deleting .. %%f
  rd /s /q "%%f"
 )
)

:end
del /q /f %_dist_dir%\release.cmd

